<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/6/28
 * Time: 15:44
 */
$studentId=$_POST['studentId'];
$studentName=$_POST['studentName'];
$studentSex=$_POST['studentSex'];
$studentBirth=$_POST['studentBirth'];
$studentAddress=$_POST['studentAddress'];
$studentStatus=$_POST['studentStatus'];
$dsn = "sqlsrv:Server=localhost;Database=Student";
$db = new PDO($dsn, "sa", "123456");
$sql="update Student set 
    StudentName='{$studentName}',StudentSex='{$studentSex}',StudentBirth='{$studentBirth}',
                   StudentAddress='{$studentAddress}',StudentStatus='{$studentStatus}'
where StudentId='{$studentId}'";
$result = $db->exec($sql);
if ($result){
    echo "修改成功,前往<a href='studentList.php'>列表页</a>";
}else{
    echo "修改失败,前往<a href='studentList.php'>列表页</a>";
}